package com.example.mapper;

import com.example.domain.Zone;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ZoneMapper {

    @Select("select * from wmy.zone")
    List<Zone> getAll();

    @Select("select * from wmy.zone where zone_id = #{zoneId}")
    Zone getById(Integer zoneId);

    @Insert("insert into wmy.zone (zone_name, zone_area, zone_treenum, zone_treevariety) values (#{zoneName}, #{zoneArea}, #{zoneTreenum}, #{zoneTreevariety})")
    boolean add(Zone zone);

    @Update("update wmy.zone set zone_name=#{zoneName},zone_area=#{zoneArea},zone_treenum=#{zoneTreenum},zone_treevariety=#{zoneTreevariety} where zone_id = #{zoneId}")
    boolean update(Zone zone);

    @Delete("delete from wmy.zone where zone_id = #{zoneId}")
    boolean delete(Integer zoneId);

}
